home *** CD-ROM | disk | FTP | other *** search
/ Painter Bear's Language Bridge — Italian / Bridge_ponte_itialian.iso / pc / helpers / open.dxr / 00017_old Q&A.txt < prev    next >
Encoding:
Text File  |  2001-02-22  |  15.0 KB  |  410 lines

  1. on goToQuiz whichBtn
  2.   global  gBridgeParts,gAnswered,gCat,gWhichBridge,gCatTitle
  3.   set gBridgeParts = 0
  4.   --    set gBridgeParts = 9
  5.   set  gAnswered = 0
  6.   repeat while gWhichBridge = VOID
  7.     set whichBridge = random(10)
  8.     if count(gBridgeLst) <> 10 and count(gBridgeLst) <> 0 then
  9.       if getPos(gBridgeLst,whichBridge) = 0 then
  10.         set gWhichBridge = whichBridge
  11.       end if
  12.     else
  13.       set gWhichBridge = whichBridge
  14.     end if
  15.   end repeat
  16.   set gCatTitle = word 1 of the name of member the memberNum of sprite whichBtn of castLib "chooser"
  17.   set gCat = word 1 of the name of member the memberNum of sprite whichBtn of castLib "chooser"
  18.   InitializeTracking gCat
  19.   clearSndList
  20.   clearAnimaList
  21.   go to frame "quiz"
  22.   doMusicBtn
  23.   putUpQuestion
  24. end goToQuiz
  25.  
  26.  
  27. on putUpQuestion
  28.   global gLangSelect,gWhichQuest,gLangName,gQuestion,gAnswer,gCat,gLangDirect,gAnsSndLst,gAnswered,gStampSpt,gQuestSndLst, gCatTitle
  29.   set the visible of sprite 1 to 0
  30.   set the visible of sprite 1 to 1
  31.   updateStage
  32.   set gAnswered = 0
  33.   set tempLst = []
  34.   set gAnsSndLst = []
  35.   set gQuestSndLst = []
  36.   if gCatTitle = "allw" or gCatTitle = "all" then
  37.     findgCat
  38.   end if
  39.   chooseQuestionNum
  40.   if gLangDirect = 1 then
  41.     set gQuestSndLst = askQuestionInEnglish (tempLst)
  42.     makeEnglishAnswerLst
  43.   else
  44.     set gQuestSndLst = askForeignQuestion (tempLst)
  45.     makeForiegnAnswerLst
  46.   end if
  47.   -- laying out text
  48.   set text = gQuestion
  49.   set letterLst = []
  50.   setBoxSize "questBox"
  51.   set letterLst = countAndCenterText (text, "whi", "center")
  52.   stampOutTxt letterLst, gStampSpt, "1"
  53.   --    put gQuestion into field "text Display"
  54.   -- laying out answers
  55.   repeat with x = 1 to 4
  56.     set text = getAt(gAnswerLst,x)
  57.     set letterLst = []
  58.     setBoxSize ("ans"&x)
  59.     set letterLst = countAndCenterText (text, "whi", "center")
  60.     stampOutTxt letterLst, gStampSpt, "1"
  61.     --    put text into field (x&&"answer")
  62.   end repeat
  63.   set the itemDelimiter to ","
  64.   repeat with x = 1 to count(gAnsSndLst)
  65.     add(tempLst,getAT(gAnsSndLst,x))
  66.   end repeat
  67.   startSndList gQuestSndLst
  68. end putUpQuestion
  69.  
  70.  
  71. on askQuestionInEnglish sndLst
  72.   global gLangSelect,gWhichQuest,gLangName,gQuestion,gAnswer,gCat, gLangDirect, gQuestSndLst,gSndPath,gFileDelimiter, gAnsSndLst,gCatTitle
  73.   set the itemDelimiter to "*"
  74.   --    set  gCat = "tphr"
  75.   --    set gWhichQuest = 109
  76.   --  if gCatTitle = "allw" or gCatTitle = "all" then
  77.   --    findgCat
  78.   --  end if
  79.   set aWord = item 2 of line gWhichQuest of field ("e "&gCat)
  80.   set gAnswer = item 3 of line gWhichQuest of field (gLangSelect&&gCat) of castLib (gLangSelect&"Cst")
  81.   set gQuestion = ("What is "&gLangName&" for "&line 1 of field "quote"&aWord&line 1 of field "quote"&"?")
  82.   set engPath = (gSndPath&"e"&gFileDelimiter)
  83.   add(sndLst,(engPath&"eQuest"&gLangSelect&".aif"))
  84.   --  add(sndLst,(engPath&gCat&gFileDelimiter&gCat&gWhichQuest&".aif"))
  85.   -- these are the ones that reference the language
  86.   if gCat = "tphr" and gWhichQuest = 109 then  -- if you're in the right category
  87.     set aSent = ("How do you say 'notebook' in "&gLangName&"?")
  88.     set gQuestion = ("What is "&gLangName&" for "&line 1 of field "quote"&aSent&line 1 of field "quote"&"?")
  89.     add(sndLst,(gSndPath&"e"&gFileDelimiter&gCat&gFileDelimiter&gLangSelect&gCat&gWhichQuest&".aif"))
  90.     add(gAnsSndLst,(gSndPath&gLangSelect&gFileDelimiter&gCat&gFileDelimiter&gCat&gWhichQuest&".aif"))
  91.   else if gCat = "tphr" and gWhichQuest = 7 then  -- if you're one of these two nubmers
  92.     set aSent = ("My "&gLangName&" is not very good.")
  93.     set gQuestion = ("What is "&gLangName&" for "&line 1 of field "quote"&aSent&line 1 of field "quote"&"?")
  94.     add(sndLst,(gSndPath&"e"&gFileDelimiter&gCat&gFileDelimiter&gLangSelect&gCat&gWhichQuest&".aif"))
  95.     add(gAnsSndLst,(gSndPath&gLangSelect&gFileDelimiter&gCat&gFileDelimiter&gCat&gWhichQuest&".aif"))
  96.   else
  97.     add(sndLst,(engPath&gCat&gFileDelimiter&gCat&gWhichQuest&".aif"))
  98.     add(gAnsSndLst,(gSndPath&gLangSelect&gFileDelimiter&gCat&gFileDelimiter&gCat&gWhichQuest&".aif"))
  99.   end if
  100.   return sndLst
  101. end askQuestionInEnglish
  102.  
  103. on makeEnglishAnswerLst 
  104.   global gAnswerLst,gAnswer,gLangName, gLangSelect,gCat,gAnsSndLst,gSndPath,gFileDelimiter
  105.   set gAnswerLst = []
  106.   add(gAnswerLst, gAnswer)
  107.   set langPath = (gSndPath&gLangSelect&gFileDelimiter)
  108.   set the itemdelimiter = "*"
  109.   repeat while count(gAnswerLst) < 4
  110.     set whichField = (gLangSelect&&gCat) -- taking other words of same language
  111.     set whichLine = random(the number of lines in field whichField)
  112.     set aLine = line whichLine of field whichField
  113.     set aAnswer = item 3 of aLine
  114.     if aAnswer = "" then
  115.       beep
  116.     end if
  117.     if getPos(gAnswerLst, aAnswer) = 0 then
  118.       add(gAnswerLst,aAnswer)
  119.       add(gAnsSndLst,(langPath&gCat&gFileDelimiter&gCat&whichLine&".aif"))
  120.     end if
  121.   end repeat
  122.   set the itemdelimiter = ","
  123.   mixUpAnswerLst
  124. end makeEnglishAnswerLst 
  125.  
  126. on askForeignQuestion sndLst
  127.   global gLangSelect,gWhichQuest,gLangName,gQuestion,gAnswer,gCat, gLangDirect,gFileDelimiter,gSndPath,gAnsSndLst,gCatTitle
  128.   --  if gCatTitle = "allw" or gCatTitle = "all" then
  129.   --    findgCat
  130.   --  end if
  131.   --  set  gCat = "tphr"
  132.   --  set gWhichQuest = 109
  133.   set the itemDelimiter to "*"
  134.   set aWord = item 3 of line gWhichQuest of field (gLangSelect&&gCat) of castLib (gLangSelect&"Cst")
  135.   if gLangSelect = "f" then
  136.     set gQuestion = ("Comment dit-on "&line 1 of field "quote"&aWord&line 1 of field "quote"&" en anglais?")
  137.   else if gLangSelect = "s" then
  138.     set gQuestion = ("¬øC√≥mo se dice "&line 1 of field "quote"&aWord&line 1 of field "quote"&" en ingl√©s?")
  139.   else if gLangSelect = "I" then
  140.     set gQuestion = ("Cos'√® l'inglese per "&line 1 of field "quote"&aWord&line 1 of field "quote"&"?")
  141.   else if gLangSelect = "g" then
  142.     set gQuestion = ("Was ist "&line 1 of field "quote"&aWord&line 1 of field "quote"&" auf englisch?")
  143.   end if
  144.   set engPath = (gSndPath&gLangSelect&gFileDelimiter)
  145.   add(sndLst,(engPath&gLangSelect&"quest.aif"))
  146.   add(sndLst,(engPath&gCat&gFileDelimiter&gCat&gWhichQuest&".aif"))
  147.   if gLangSelect = "g" or gLangSelect = "f" or gLangSelect = "s" then
  148.     add(sndLst,(engPath&gLangSelect&"quest2.aif"))
  149.   end if
  150.   
  151.   if gCat = "tphr" and gWhichQuest = 109 then
  152.     set gAnswer = ("How do you say 'notebook' in "&gLangName&"?")
  153.     add(gAnsSndLst,(gSndPath&"e"&gFileDelimiter&gCat&gFileDelimiter&gLangSelect&gCat&gWhichQuest&".aif"))
  154.   else if gCat = "tphr" and gWhichQuest = 7 then
  155.     set gAnswer = ("My "&gLangName&" is not very good.")
  156.     add(gAnsSndLst,(gSndPath&"e"&gFileDelimiter&gCat&gFileDelimiter&gLangSelect&gCat&gWhichQuest&".aif"))
  157.   else
  158.     set gAnswer = item 2 of line gWhichQuest of field ("e "&gCat)
  159.     add(gAnsSndLst,(gSndPath&"e"&gFileDelimiter&gCat&gFileDelimiter&gCat&gWhichQuest&".aif"))
  160.   end if
  161.   return sndLst
  162. end askForeignQuestion
  163.  
  164.  
  165. on makeForiegnAnswerLst
  166.   global gAnswerLst,gAnswer,gLangName, gLangSelect,gCat
  167.   global gSndPath,gFileDelimiter,gCat,gFileDelimiter,gAnsSndLst
  168.   set gAnswerLst = []
  169.   add(gAnswerLst, gAnswer)
  170.   set langPath = (gSndPath&"e"&gFileDelimiter)
  171.   set the itemdelimiter = "*"
  172.   repeat while count(gAnswerLst) < 4
  173.     set whichField = ("e"&&gCat) -- taking other words of same language
  174.     set whichLine = random(the number of lines in field whichField)
  175.     set aLine = line whichLine of field whichField
  176.     set aAnswer = item 2 of aLine
  177.     if getPos(gAnswerLst, aAnswer) = 0 then
  178.       add(gAnswerLst,aAnswer)
  179.       add(gAnsSndLst,(langPath&gCat&gFileDelimiter&gCat&whichLine&".aif"))
  180.     end if
  181.   end repeat
  182.   set the itemdelimiter = ","
  183.   mixUpAnswerLst
  184. end makeForiegnAnswerLst
  185.  
  186.  
  187. on mixUpAnswerLst 
  188.   global gAnswerLst, gAnswerSpt,gAnswer,gAnsSndLst,gSndPath
  189.   set tempLst = []
  190.   set tempSndLst = []
  191.   repeat while count(tempLst) < 4
  192.     set aAnswer = random(count(gAnswerLst))
  193.     add(tempLst,getAT(gAnswerLst,aAnswer))
  194.     add(tempSndLst,getAT(gAnsSndLst,aAnswer))
  195.     if getAT(gAnswerLst,aAnswer) = gAnswer then
  196.       set gAnswerSpt = count(tempLst)
  197.     end if
  198.     deleteAt(gAnswerLst,aAnswer)
  199.     deleteAt(gAnsSndLst,aAnswer)
  200.   end repeat
  201.   set gAnswerLst = tempLst
  202.   --    set gAnsSndLst = tempSndLst
  203.   set gAnsSndLst = []
  204.   repeat with x = 1 to count(tempSndLst)
  205.     add(gAnsSndLst,getAt(tempSndLst,x))
  206.     add(gAnsSndLst,(gSndPath&"noSnd.aif"))
  207.   end repeat
  208. end mixUpAnswerLst 
  209.  
  210. on enterAnswer whichBtn
  211.   global gAnswerRight,gAnswerSpt,gAnswered,gAnswerLinesBox,gfstLftArr,gLstRtArr,gClickNote,gBridgeMonitor, gBridgeParts, gRightTag, gStampSpt, gEyeSprite,gSwitchSpt,gLangDirect,gLangSelect
  212.   if gAnswered <> 1 then
  213.     set gAnswered = 1
  214.     set the membernum of sprite gAnswerLinesBox to the number of member "answerarea gray"   -- gray out answer fields
  215.     -- gray out arrows
  216.     repeat with x = gfstLftArr to gLstRtArr
  217.       if x <> gfstLftArr + 1 and x <> gfstLftArr + 4 and x <> gfstLftArr + 7 and x <> gfstLftArr + 10 then
  218.         put the name of member the memberNum of sprite x of castLib "quiz" into foo
  219.         put "gray" into word (the number of words in foo) of foo
  220.         set the memberNum of sprite x to the number of member foo
  221.       end if
  222.     end repeat
  223.     set the memberNum of sprite gEyeSprite to the number of member ("eye gray")
  224.     set the memberNum of sprite gSwitchSpt to the number of member ("switch gray")
  225.     -- click to continue
  226.     if gLangDirect = 1 then
  227.       set the membernum of sprite gClickNote to the number of member "e click up"
  228.     else
  229.       set the membernum of sprite gClickNote to the number of member (gLangSelect&" click up")
  230.     end if
  231.     -- stop talking/idling
  232.     clearSndList
  233.     --    clearAnimalist
  234.     -- figuring right or wrong
  235.     put the name of member the memberNum of sprite whichBtn of castLib "quiz" into foo
  236.     set foo = value(word 1 of foo)
  237.     
  238.     -- re-write answers: right in green, wrong in red, others in another color
  239.     repeat with x = 1 to 4
  240.       set text = getAt(gAnswerLst,x)
  241.       set letterLst = []
  242.       setBoxSize ("ans"&x)
  243.       if x = gAnswerSpt then
  244.         set whichColor = "grn"
  245.       else if x = foo and foo <> gAnswerSpt then
  246.         set whichColor = "red"
  247.       else
  248.         set whichColor = "whi"
  249.       end if
  250.       set letterLst = countAndCenterText (text, whichColor, "center")
  251.       stampOutTxt letterLst, gStampSpt, "1"
  252.       --    put text into field (x&&"answer")
  253.     end repeat
  254.     if gAnswerSpt = foo then
  255.       set gAnswerRight = 1
  256.       -- bridge
  257.       set gBridgeParts = gBridgeParts + 1
  258.       set the membernum of sprite gBridgeMonitor to the number of member ("bridge "&gBridgeParts)
  259.       if gLangDirect = 1 then
  260.         set the membernum of sprite gRightTag to the number of member "e correct"-- correct/incorrect
  261.       else
  262.         set the membernum of sprite gRightTag to the number of member (gLangSelect&" correct")
  263.       end if
  264.     else
  265.       if gLangDirect = 1 then
  266.         set the membernum of sprite gRightTag to the number of member "e incorrect"-- correct/incorrect
  267.       else
  268.         set the membernum of sprite gRightTag to the number of member (gLangSelect&" incorrect")
  269.       end if
  270.       set gAnswerRight = 0
  271.     end if
  272.     -- tracking
  273.     TrackAnswer gAnswerRight, getAT(gAnswerLst,gAnswerSpt), getAT(gAnswerLst,foo)
  274.     doFeedBack -- bear feedback: oral and animated
  275.   end if
  276. end enterAnswer
  277.  
  278.  
  279.  
  280. on resetQwest
  281.   global gAnswerLinesBox,gfstLftArr,gLstRtArr,gClickNote,gBridgeParts, gRightTag,gWhichBridge,gBridgeLst,gEyeSprite, gSwitchSpt
  282.   set gAnswered = 0
  283.   -- stop talking/idling
  284.   clearSndList
  285.   clearAnimalist
  286.   if gBridgeParts <> 10 then 
  287.     set the membernum of sprite gAnswerLinesBox to the number of member "answerarea"   -- bring back answer fields
  288.     -- bring back arrows
  289.     repeat with x = gfstLftArr to gLstRtArr
  290.       if x <> gfstLftArr + 1 and x <> gfstLftArr + 4 and x <> gfstLftArr + 7 and x <> gfstLftArr + 10 then
  291.         put the name of member the memberNum of sprite x of castLib "quiz" into foo
  292.         put "up" into word (the number of words in foo) of foo
  293.         set the memberNum of sprite x to the number of member foo
  294.       end if
  295.     end repeat
  296.     set the memberNum of sprite gEyeSprite to the number of member ("eye up")
  297.     set the memberNum of sprite gSwitchSpt to the number of member ("switch up")
  298.     -- click to continue
  299.     set the membernum of sprite gClickNote to the number of member "click gray"
  300.     set the memberNum of sprite gRightTag to the number of member ("e 2 correct") -- correct/incorrect
  301.     putUpQuestion  -- feed next question
  302.   else
  303.     if getPos(gBridgeLst,gWhichBridge) = 0 then
  304.       add(gBridgeLst,gWhichBridge)
  305.     end if
  306.     viewBridge
  307.   end if
  308. end resetQwest
  309.  
  310.  
  311.  
  312. ------------------------------------------------ Q&A choices ------------------------------------------
  313. on setLangSelect whichBtn
  314.   global gLangSelect,gLangName,gLangDirect
  315.   put the name of member the memberNum of sprite whichBtn  of castLib "chooser" into foo
  316.   set gLangSelect = word 1 of foo
  317.   case gLangSelect of
  318.     "g": set gLangName = "German"
  319.     "i": set gLangName = "Italian"
  320.     "s": set gLangName = "Spanish"
  321.     "f": set gLangName = "French"
  322.     "L": set gLangName = "Latin"
  323.     "P": set gLangName = "Portuguese"
  324.   end case
  325.   if gLangDirect = 1 then
  326.     put ("English to "&gLangName) into field "direction"
  327.   else
  328.     put (gLangName&" to English") into field "direction"
  329.   end if
  330. end setLangSelect
  331.  
  332. on switchLangDir
  333.   global gLangDirect,gLangName
  334.   if the frameLabel = "find" then -- clear all fields!
  335.     put "" into field "possWords"
  336.     put "" into field "wordFound"
  337.     put "" into field "wordFind"
  338.   end if
  339.   if gLangDirect = 1 then
  340.     set gLangDirect = 0
  341.     put (gLangName&" to English") into field "direction"
  342.   else
  343.     set gLangDirect = 1
  344.     put ("English to "&gLangName) into field "direction"
  345.   end if
  346.   if the framelabel = "quiz" then
  347.     putUpQuestion
  348.   else if the frameLabel  = "find" then
  349.     prepWdFind
  350.   else if the frameLabel = "chooser" then
  351.     prepChooser
  352.   end if
  353. end switchLangDir
  354.  
  355. on chooseQuestionNum
  356.   global gWhichQuest,gPastQwestLst,gCat
  357.   set gWhichQuest = VOID
  358.   repeat while gWhichQuest = VOID
  359.     set whichQwest = random(the number of lines in field ("e "&gCat))
  360.     if  getPOs(gPastQwestLst,whichQwest) = 0 then
  361.       add(gPastQwestLst,whichQwest)
  362.       set gWhichQuest = whichQwest
  363.     end if
  364.   end repeat
  365.   if count(gPastQwestLst) >= 8 then
  366.     deleteAt(gPastQwestLst,1)
  367.   end if
  368. end chooseQuestionNum
  369.  
  370.  
  371. on findgCat
  372.   global gCatTitle,gCat
  373.   if gCatTitle = "allw" then
  374.     set fooNum = random(27)
  375.   else if gCatTitle = "all" then
  376.     set fooNum = random(31)
  377.   end if
  378.   case fooNum of
  379.     "1":set gCat = "rltv"
  380.     "2":set gCat = "advb"
  381.     "3":set gCat = "adjv"
  382.     "4":set gCat = "verb"
  383.     "5":set gCat = "schl"
  384.     "6":set gCat = "tran"
  385.     "7":set gCat = "colr"
  386.     "8":set gCat = "dirc"
  387.     "9":set gCat = "spor"
  388.     "10":set gCat = "occp"
  389.     "11":set gCat = "anml"
  390.     "12":set gCat = "food"
  391.     "13":set gCat = "trvl"
  392.     "14":set gCat = "body"
  393.     "15":set gCat = "buil"
  394.     "16":set gCat = "city"
  395.     "17":set gCat = "hous"
  396.     "18":set gCat = "furn"
  397.     "19":set gCat = "weat"
  398.     "20":set gCat = "conj"
  399.     "21":set gCat = "numb"
  400.     "22":set gCat = "bath"
  401.     "23":set gCat = "kitc"
  402.     "24":set gCat = "time"
  403.     "25":set gCat = "geog"
  404.     "26":set gCat = "clth"
  405.     "27":set gCat = "stor"
  406.     "28","30":set gCat = "tphr"
  407.     "29","31":set gCat = "mphr"
  408.   end case
  409.   return foo
  410. end findgCat